<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>CloudPilot - 云资源管理平台</title>
    
    <!-- Bootstrap 5.3 CSS -->
    <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.3.2/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <!-- Custom CSS -->
    <link href="css/style.css" rel="stylesheet">
</head>
<body>
    <!-- 登录页面 -->
    <div id="loginPage" class="d-flex align-items-center justify-content-center min-vh-100 bg-light">
        <div class="container">
            <div class="row justify-content-center">
                <div class="col-md-6 col-lg-4">
                    <div class="card shadow">
                        <div class="card-body p-5">
                            <div class="text-center mb-4">
                                <i class="fas fa-cloud fa-3x text-primary mb-3"></i>
                                <h2 class="h4">CloudPilot</h2>
                                <p class="text-muted">云资源管理平台</p>
                            </div>
                            
                            <form id="loginForm">
                                <div class="mb-3">
                                    <label class="form-label">云厂商</label>
                                    <select class="form-select" id="cloudProvider" required>
                                        <option value="">请选择云厂商</option>
                                        <option value="aliyun">阿里云</option>
                                        <option value="tencent">腾讯云</option>
                                        <option value="huawei">华为云</option>
                                    </select>
                                </div>
                                
                                <div class="mb-3">
                                    <label class="form-label">Access Key</label>
                                    <input type="text" class="form-control" id="accessKey" placeholder="请输入 Access Key" required>
                                </div>
                                
                                <div class="mb-4">
                                    <label class="form-label">Secret Key</label>
                                    <input type="password" class="form-control" id="secretKey" placeholder="请输入 Secret Key" required>
                                </div>
                                
                                <button type="submit" class="btn btn-primary w-100">
                                    <i class="fas fa-sign-in-alt me-2"></i>登录
                                </button>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 仪表盘页面 -->
    <div id="dashboardPage" class="d-none">
        <!-- 导航栏 -->
        <nav class="navbar navbar-expand-lg navbar-dark bg-primary">
            <div class="container-fluid">
                <a class="navbar-brand" href="#">
                    <i class="fas fa-cloud me-2"></i>CloudPilot
                </a>
                <div class="d-flex align-items-center">
                    <select class="form-select form-select-sm me-3" id="regionSelector" style="width: auto;">
                        <option value="">选择区域</option>
                        <option value="cn-hangzhou">华东1(杭州)</option>
                        <option value="cn-shanghai">华东2(上海)</option>
                        <option value="cn-beijing">华北2(北京)</option>
                        <option value="cn-shenzhen">华南1(深圳)</option>
                    </select>
                    <button class="btn btn-outline-light btn-sm" onclick="logout()">
                        <i class="fas fa-sign-out-alt me-1"></i>退出
                    </button>
                </div>
            </div>
        </nav>

        <!-- 主内容区 -->
        <div class="container-fluid mt-4">
            <!-- 统计卡片 -->
            <div class="row mb-4">
                <div class="col-md-3">
                    <div class="card bg-primary text-white">
                        <div class="card-body">
                            <div class="d-flex justify-content-between">
                                <div>
                                    <h6 class="card-title">云服务器</h6>
                                    <h3 class="mb-0" id="ecsCount">0</h3>
                                </div>
                                <i class="fas fa-server fa-2x"></i>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="card bg-success text-white">
                        <div class="card-body">
                            <div class="d-flex justify-content-between">
                                <div>
                                    <h6 class="card-title">对象存储</h6>
                                    <h3 class="mb-0" id="ossCount">0</h3>
                                </div>
                                <i class="fas fa-hdd fa-2x"></i>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="card bg-warning text-white">
                        <div class="card-body">
                            <div class="d-flex justify-content-between">
                                <div>
                                    <h6 class="card-title">数据库</h6>
                                    <h3 class="mb-0" id="rdsCount">0</h3>
                                </div>
                                <i class="fas fa-database fa-2x"></i>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-md-3">
                    <div class="card bg-info text-white">
                        <div class="card-body">
                            <div class="d-flex justify-content-between">
                                <div>
                                    <h6 class="card-title">负载均衡</h6>
                                    <h3 class="mb-0" id="slbCount">0</h3>
                                </div>
                                <i class="fas fa-balance-scale fa-2x"></i>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 资源列表 -->
            <div class="row">
                <div class="col-12">
                    <div class="card">
                        <div class="card-header d-flex justify-content-between align-items-center">
                            <h5 class="mb-0">云资源列表</h5>
                            <button class="btn btn-primary btn-sm" onclick="refreshResources()">
                                <i class="fas fa-sync-alt me-1"></i>刷新
                            </button>
                        </div>
                        <div class="card-body">
                            <div id="resourceList" class="row">
                                <!-- 资源卡片将动态加载 -->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- 监控模态框 -->
    <div class="modal fade" id="monitorModal" tabindex="-1">
        <div class="modal-dialog modal-lg">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title">实时监控</h5>
                    <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                </div>
                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-4">
                            <canvas id="cpuChart" width="200" height="100"></canvas>
                        </div>
                        <div class="col-md-4">
                            <canvas id="memoryChart" width="200" height="100"></canvas>
                        </div>
                        <div class="col-md-4">
                            <canvas id="networkChart" width="200" height="100"></canvas>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- Bootstrap JS -->
    <script src="https://cdn.bootcdn.net/ajax/libs/bootstrap/5.3.2/js/bootstrap.bundle.min.js"></script>
    <!-- Chart.js -->
    <script src="https://cdn.bootcdn.net/ajax/libs/Chart.js/4.4.0/chart.min.js"></script>
    <!-- Custom JS -->
    <script src="js/app.js"></script>
</body>
</html>
